package com.sdyc.ndmp.cls.model;

import com.sdyc.ndmp.cls.engine.Match;

import java.io.Serializable;
import java.util.List;
import java.util.Set;

public class MomW implements Serializable {

    private int contains = 0;

    private Set<String> words;

    private List<SonW> sons;

    /**
     搜索范围: CONTENT/TITLE/FULLTEXT/SOURCE
     */
    private String field;

    public int getContains() {
        return contains;
    }

    public void setContains(int contains) {
        this.contains = contains;
    }

    public Set<String> getWords() {
        return words;
    }

    public void setWords(Set<String> words) {
        this.words = words;
    }

    public List<SonW> getSons() {
        return sons;
    }

    public void setSons(List<SonW> sons) {
        this.sons = sons;
    }

    public String getField() {
        return field;
    }

    public void setField(String field) {
        this.field = field;
    }

    @Override
    public String toString() {
        StringBuilder sb=new StringBuilder();
        switch (Match.valueOf(contains)){
            case MATCH_ALL:
                sb.append("全部包含");break;
            case MATCH_ANY:
                sb.append("任意包含");break;
            case MATCH_NOT:
                sb.append("不包含");break;
        }
        sb.append(words);

        return sb.toString();
    }
}
